package com.example.demo.Mapper;

import com.example.demo.Entity.Evaluation;
import org.apache.ibatis.annotations.*;

@Mapper
public interface EvaluationMapper {
    @Select("SELECT * FROM self_evaluation WHERE person_id = #{userId}")
    Evaluation findByUserId(Long userId);

    // 更新自我评价
    @Update("UPDATE self_evaluation SET content = #{content} WHERE person_id = #{person_id}")
    int updateEvaluation(Evaluation evaluation);

    // 删除自我评价
    @Delete("DELETE FROM self_evaluation WHERE person_id = #{userId}")
    int deleteByUserId(Long userId);

    // 插入自我评价
    @Insert("INSERT INTO self_evaluation(person_id, content) VALUES(#{person_id}, #{content})")
    int insert(Evaluation evaluation);
}
